import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [{
            path: '/',
            redirect: '/core'
        },
        {
            path: '/',
            component: () => import('../components/common/Whole.vue'),
            meta: {
                title: '数据看板'
            },
            children: [{
                    path: '/dashboard',
                    component: () => import('../page/Dashboard.vue'),
                    meta: {
                        title: '首页'
                    },
                    redirect:'/Home',     // 该配置是若点击选择父目录时，默认选中该父目录下的子路径页面
                        children: [{
                            path: '/Home',
                            component: () => import('../page/Dashboard.vue'),
                            meta: {
                                title: '首页'
                            },
                        }
                ]
                },
                {
                    path: '/core',
                    component: () => import('../page/core/index.vue'),
                    meta: {
                        title: '核心看板'
                    },
                    redirect:'/core/deal',     // 该配置是若点击选择一级菜单时，默认选中并跳转到该一级菜单下的第一个二级菜单
                        children:[
                            {
                                path: 'deal',
                                component: () => import('../page/core/deal.vue'),
                                meta: {
                                    title: '交易看板'
                                },
                            }
                        ]
                },
                {
                    path: '/agility',
                    component: () => import('../page/agility/index.vue'),
                    meta: {
                        title: '敏捷看板'
                    },
                    redirect:'/agility/behavior',     // 该配置是若点击选择父目录时，默认选中该父目录下的子路径页面
                        children:[
                            {
                                path: 'behavior',
                                component: () => import('../page/agility/behavior.vue'),
                                meta: {
                                    title: '行为看板'
                                },
                            },
                            {
                                path: 'grow',
                                component: () => import('../page/agility/grow.vue'),
                                meta: {
                                    title: '增长看板'
                                },
                            },
                        ]
                },
                {
                    path: '/test3',
                    component: () => import('../page/test3/index.vue'),
                    meta: {
                        title: '一级菜单3'
                    },
                    redirect:'/test3/test3-1',
                    children:[
                        {
                            path: 'test3-1',
                            component: () => import('../page/test3/test3-1.vue'),
                            meta: {
                                title: '二级菜单3-1'
                            }
                        },
                        {
                            path: 'test3-2',
                            component: () => import('../page/test3/test3-2.vue'),
                            meta: {
                                title: '二级菜单3-2'
                            }
                        },
                    ]
                },
                {
                    // 国际化组件
                    path: '/i18n',
                    component: () => import('../components/common/I18n.vue'),
                    meta: {
                        title: '国际化'
                    }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: () => import('../page/Permission.vue'),
                    meta: {
                        title: '权限测试',
                        permission: true
                    }
                },
                {
                    path: '/404',
                    component: () => import('../page/404.vue'),
                    meta: {
                        title: '404'
                    }
                },
                {
                    path: '/403',
                    component: () => import('../page/403.vue'),
                    meta: {
                        title: '403'
                    }
                },
            ]
        },
        {
            // 登录页面
            path: '/login',
            component: () => import('../page/Login.vue'),
            meta: {
                title: '登录'
            }
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
